﻿using CsvHelper.Configuration.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAchive.Model.Excel.Export
{
    /// <summary>
    /// 详情
    /// </summary>
    public class DetailReport
    {
        [Name("设备号")]
        [Description("设备号")]
        public string Equipment {  get; set; }
       
        [Ignore]
        public string LineId { get; set; }
        [Ignore]
        public int Id {  get; set; }
        [Name("站点号")]
        [Description("站点号")]
        public int SiteId {  get; set; }
        [Ignore]
        public string SiteName {  get; set; }
        [Name("条码")]
        [Description("条码")]
        public string LotId {  get; set; }

        [Ignore]
        public DateTime CreateTime { get; set; }
        [Name("记录时间")]
        [Description("记录时间")]
        public string CreateTimeStr
        {
            get {
                if (CreateTime == DateTime.MinValue)
                {
                    return "";
                }
                return CreateTime.ToString();
            }
            set { }
        }
        [Ignore]
        public DateTime FinishTime { get; set; }
        [Name("完成时间")]
        [Description("完成时间")]
        public string FinishTimeStr
        {
            get {
                if (FinishTime == DateTime.MinValue) 
                {
                    return "";
                }
                return FinishTime.ToString();
            }
            set { }
        }

        [Name("AI检出缺陷")]
        [Description("AI检出缺陷")]
        public string AiDetectInfo { get; set; }
        [Name("人工检出缺陷")]
        [Description("人工检出缺陷")]
        public string HumanDetectInfo { get; set; }
        [Name("AI判断结果")]
        [Description("AI判断结果")]
        public string AiDetectResult { get; set; }
        [Name("人工判断结果")]
        [Description("人工判断结果")]
        public string HumanDetectResult {  get; set; }

        /// <summary>
        /// vi el viback
        /// </summary>
        [Ignore]
        public string DetectType {  get; set; }

        [Name("检测类型")]
        [Description("检测类型")]
        public string DetectTypeStr 
        {
            get
            {
                if (string.IsNullOrWhiteSpace(DetectType))
                {
                    return "";
                }
                else if (DetectType == "0")
                {
                    return "EL";
                }
                else if (DetectType == "1") 
                {
                    return "正面";
                }
                else if (DetectType == "2")
                {
                    return "背面";
                }
                else
                {
                    return DetectType;
                }
             
            }
            set { }
        }
        [Name("漏检/过判")]
        [Ignore]
        public string LouJianOrGuopan 
        {
            get; 
            set; 
        }
        [Ignore]
        public DateTime LotCaptureTime {  get; set; }
        [Ignore]
        public DateTime SendAiTime { get; set; }
        [Ignore]
        public decimal AiCalculateTime {  get; set; }
        [Ignore]
        public DateTime HumanJudgeTime {  get; set; }

        [Name("人工复判时间")]
        [Ignore]
       // [Description("人工复判时间")]
        public string HumanJudgeTimeStr 
        {
            get { return HumanJudgeTime.ToString(); }
            set { } 
        }
        [Name("分类")]
        [Description("分类")]
        public string Classify {  get; set; }


    }









    /// <summary>
    /// 详情
    /// </summary>
    public class ColRowReport
    {
        [Name("设备号")]
        [Description("设备号")]
        public string Equipment { get; set; }

        [Name("线别号")]
        [Description("线别号")]
        public string LineId { get; set; }
        [Ignore]
        public int Id { get; set; }
        [Name("站点号")]
        [Description("站点号")]
        public int SiteId { get; set; }
        [Ignore]
        public string SiteName { get; set; }
        [Name("条码")]
        [Description("条码")]
        public string LotId { get; set; }

        [Name("分类")]
        // [Description("分类")]
        [Ignore]
        public string Classify { get; set; }

        [Ignore]
        public DateTime ElCreateTime { get; set; }
        [Name("El记录时间")]
        [Description("El记录时间")]
        public string ElCreateTimeStr
        {
            get {
                if (ElCreateTime == DateTime.MinValue)
                {
                    return "";
                }
                return ElCreateTime.ToString(); 
            }
            set { }
        }

        [Ignore]
        public DateTime VICreateTime { get; set; }
        [Name("VI正面记录时间")]
        [Description("VI正面记录时间")]
        public string VICreateTimeStr
        {
            get {
                if (VICreateTime == DateTime.MinValue)
                {
                    return "";
                }
                return VICreateTime.ToString(); 
            }
            set { }
        }

        [Ignore]
        public DateTime VBCreateTime { get; set; }
        [Name("VI背面记录时间")]
        [Description("VI背面记录时间")]
        public string VBCreateTimeStr
        {
            get {
                if (VBCreateTime == DateTime.MinValue)
                {
                    return "";
                }
                return VBCreateTime.ToString();
            }
            set { }
        }

        [Ignore]
        public DateTime ElFinishTime { get; set; }
        [Name("El完成时间")]
        [Description("El完成时间")]
        public string ElFinishTimeStr
        {
            get {
                if (ElFinishTime == DateTime.MinValue)
                {
                    return "";
                }
                return ElFinishTime.ToString(); 
            }
            set { }
        }

        [Ignore]
        public DateTime VIFinishTime { get; set; }
        [Name("VI正面完成时间")]
        [Description("VI正面完成时间")]
        public string VIFinishTimeStr
        {
            get {
                if (VIFinishTime == DateTime.MinValue)
                {
                    return "";
                }
                return VIFinishTime.ToString(); 
            }
            set { }
        }

        [Ignore]
        public DateTime VBFinishTime { get; set; }
        [Name("VI背面完成时间")]
        [Description("VI背面完成时间")]
        public string VBFinishTimeStr
        {
            get {
                if (VBFinishTime == DateTime.MinValue)
                {
                    return "";
                }
                return VBFinishTime.ToString();
            }
            set { }
        }

        [Name("El的AI检出缺陷")]
        [Description("El的AI检出缺陷")]
        public string ElAiDetectInfo { get; set; }

        [Name("El人工检出缺陷")]
        [Description("El人工检出缺陷")]
        public string ElHumanDetectInfo { get; set; }


        [Name("Vi正面AI检出缺陷")]
        [Description("Vi正面Ai检出缺陷")]
        public string ViAiDetectInfo { get; set; }


        [Name("Vi正面人工检出缺陷")]
        [Description("Vi正面人工检出缺陷")]
        public string VIHumanDetectInfo { get; set; }

        [Name("Vi背面AI检出缺陷")]
        [Description("Vi背面AI检出缺陷")]
        public string VBAiDetectInfo { get; set; }


        [Name("Vi背面人工检出缺陷")]
        [Description("Vi背面人工检出缺陷")]
        public string VBHumanDetectInfo { get; set; }

        [Name("El的AI判断结果")]
        [Description("El的AI判断结果")]
        public string ElAiDetectResult { get; set; }

        [Name("El人工判断结果")]
        [Description("El人工判断结果")]
        public string ElHumanDetectResult { get; set; }

        [Name("Vi正面的AI判断结果")]
        [Description("Vi正面的AI判断结果")]
        public string VIAiDetectResult { get; set; }

        [Name("VI正面人工判断结果")]
        [Description("VI正面人工判断结果")]
        public string VIHumanDetectResult { get; set; }

        [Name("Vi背面的AI判断结果")]
        [Description("Vi背面的AI判断结果")]
        public string VBAiDetectResult { get; set; }


        [Name("VI背面人工判断结果")]
        [Description("VI背面人工判断结果")]
        public string VBHumanDetectResult { get; set; }

        /// <summary>
        /// vi el viback
        /// </summary>
        [Ignore]
        public string DetectType { get; set; }

       
        [Name("漏检/过判")]
        [Description("漏检/过判")]
        // [Ignore]
        public string LouJianOrGuopan
        {
            get;
            set;
        }
        [Ignore]
        public DateTime LotCaptureTime { get; set; }
        [Ignore]
        public DateTime SendAiTime { get; set; }
        [Ignore]
        public decimal AiCalculateTime { get; set; }

     
        [Ignore]
        public TimeSpan HumanJudgeTime { get; set; } = TimeSpan.MinValue;

        [Name("人工复判时间")]
        [Description("人工复判时间")]
        public string HumanJudgeTimeStr
        {
            get {
                if(HumanJudgeTime == TimeSpan.MinValue)
                {
                    return "";
                }
                else if (HumanJudgeTime == TimeSpan.Zero)
                {
                    return "0";
                }
                return HumanJudgeTime.TotalSeconds.ToString()+"s"; 
            }
            set { }
        }

        [Name("是否直通")]
       // [Description("是否直通")]
         [Ignore]
        public string IsDirect { get; set; }


    }
}
